package cn.ld.module.infra.dal.mapper.demo.demo03;

import cn.ld.framework.common.pojo.PageParam;
import cn.ld.framework.common.pojo.PageResult;
import cn.ld.framework.mybatis.core.mapper.BaseMapperX;
import cn.ld.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.ld.module.infra.dal.entity.demo.demo03.Demo03GradeEntity;
import org.apache.ibatis.annotations.Mapper;

/**
 * 学生班级 Mapper
 *
 * @author 蓝盾
 */
@Mapper
public interface Demo03GradeMapper extends BaseMapperX<Demo03GradeEntity> {

    default PageResult<Demo03GradeEntity> selectPage(PageParam inVO, Long studentId) {
        return selectPage(inVO, new LambdaQueryWrapperX<Demo03GradeEntity>()
                .eq(Demo03GradeEntity::getStudentId, studentId)
                .orderByDesc(Demo03GradeEntity::getId));
    }

    default Demo03GradeEntity selectByStudentId(Long studentId) {
        return selectOne(Demo03GradeEntity::getStudentId, studentId);
    }

    default int deleteByStudentId(Long studentId) {
        return delete(Demo03GradeEntity::getStudentId, studentId);
    }

}